import _ from "lodash";

export const planList = (list) => {
  const array = (list || []).map((o) => {
    const newO = {};
    Object.entries(o).forEach(([k, v]) => {
      if (_.isString(v)) {
        newO[k] = v.trim();
      } else if (_.isNumber(v)) {
        if (_.isInteger(v)) {
          newO[k] = v;
        } else {
          newO[k] = v.toFixed(4);
        }
      } else {
        newO[k] = v;
      }
    });
    return newO;
  });
  return array;
};
